﻿#include <QCoreApplication>
#include <QCommandLineParser>
#include <QCommandLineOption>

#include "g_ver.h"
#include "handler.h"

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    a.setApplicationName(SP_NAME);
    a.setApplicationVersion(SP_VERSION);

    QCommandLineParser parser;
    parser.addHelpOption();
    parser.addVersionOption();
    parser.addPositionalArgument("config","[JSON] config file");
    parser.process(a);

    const QStringList args=parser.positionalArguments();
    if(args.isEmpty())
    {
        qDebug() << "missing config file";
        return 0;
    }

    Handler handler;
    handler.read_config(args.first());

    return 0;
}
